package com.gientech.group9.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gientech.group9.model.valid.ApplyRecordSave;
import com.gientech.group9.model.valid.AuditOperation;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;


@Data
@Entity
public class ApplyRecord {
    @Id
    @GenericGenerator(name="gen",strategy="increment")
    @GeneratedValue(generator="gen")
    @Column(name = "apply_id", unique = true, nullable = false, precision = 15, scale = 0)
    private Integer applyId;
    @NotEmpty(groups = ApplyRecordSave.class)
    private String customerName;

    private Integer customerId;
    @NotNull(groups = ApplyRecordSave.class)
    private Integer sex;
    @NotEmpty(groups = ApplyRecordSave.class)
    private String sfzNo;
    @NotEmpty(groups = ApplyRecordSave.class)
    private String bankCard;
    @NotNull(groups = ApplyRecordSave.class)
    private Integer lornType;
    @NotNull(groups = AuditOperation.class)
    //-1 客户自己取消 -2 被拒绝 0 未处理  1初审通过 2 初审未通过等待合规性审核 ,3合规性审核通过待信贷审批 4合规性审核拒绝 5 信贷审批通过待签订合同 6 合同已签订代发放贷款 7 贷款已发放
    private Integer status;
    @NotNull(groups = ApplyRecordSave.class)
    private BigDecimal applyAmount;
    @NotNull(groups = ApplyRecordSave.class)
    private Integer terms;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditDate;

    private String processInstanceId;

}
